import java.security.Key;
import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Map<Integer,Student> stu = new HashMap<>(){{
            put(1,new Student(1,"张三",19));
            put(2,new Student(2,"李四",20));
            put(3,new Student(3,"王五",18));
        }};

        stu.forEach((id,s) -> System.out.println("学号："+s.getId() + "  姓名："+s.getName() + "  年龄："+s.getAge()));
        System.out.println();

        Integer id = 2;
        System.out.println("学号："+stu.get(id).getId() + "  姓名："+stu.get(id).getName() +"  年龄：" + stu.get(id).getAge());
    }
}
